﻿using MediatR;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WebMediaTRApi.Services;
using WebMediaTRApi.WeatherForcasts.Querys;

namespace WebMediaTRApi.WeatherForcasts.Handlers
{
    public class WeatherForecastQueryHandler : RequestHandler<Weather_ForecastQuery, IEnumerable<WeatherForecast>>
    {
        private readonly WeatherForecastService _service;

        public WeatherForecastQueryHandler(WeatherForecastService service)
        {
            _service = service;
        }

        protected override IEnumerable<WeatherForecast> Handle(Weather_ForecastQuery request)
        {
            return _service.GetWeatherForecasts();
        }
    }
}
